home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / os2tools / bnklysrc / sb_fill.c < prev    next >
C/C++ Source or Header  |  1989-01-01  |  6KB  |  150 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /*                                                                          */
  4. /*      ------------         Bit-Bucket Software <no-Inc>                   */
  5. /*      \ 10001101 /         Writers and Distributors of                    */
  6. /*       \ 011110 /          No-Cost<no-tm> Software.                       */
  7. /*        \ 1011 /                                                          */
  8. /*         ------                                                           */
  9. /*                                                                          */
  10. /*  Copyright (C) 1987, 1988, 1989 by Robert Hartman and Vincent Perriello  */
  11. /*                                                                          */
  12. /*                                                                          */
  13. /*              Box Filling subroutines for BinkleyTerm 2.10                */
  14. /*                                                                          */
  15. /*                                                                          */
  16. /*    For complete  details  of the licensing restrictions, please refer    */
  17. /*    to the License  agreement,  which  is published in its entirety in    */
  18. /*    the MAKEFILE and BT.C, and also contained in the file LICENSE.210.    */
  19. /*                                                                          */
  20. /*    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  21. /*    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  22. /*    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    */
  23. /*    NOT HAVE THESE FILES,  YOU SHOULD  IMMEDIATELY CONTACT THE AUTHORS    */
  24. /*    AT THE  ADDRESSES LISTED BELOW.  IN NO EVENT SHOULD YOU PROCEED TO    */
  25. /*    USE   THIS  FILE  WITHOUT  HAVING   ACCEPTED  THE  TERMS  OF   THE    */
  26. /*    BINKLEYTERM  LICENSING AGREEMENT,  OR SUCH OTHER  AGREEMENT AS YOU    */
  27. /*    ARE ABLE TO REACH WITH THE AUTHORS.                                   */
  28. /*                                                                          */
  29. /*                                                                          */
  30. /*    The Authors can be reached at the following addresses:                */
  31. /*                                                                          */
  32. /*    Robert C. Hartman                      Vincent E. Perriello           */
  33. /*    Spark Software                         VEP Software                   */
  34. /*    427-3 Amherst Street                   111 Carroll Street             */
  35. /*    CS2032, Suite 232                      Naugatuck, CT 06770            */
  36. /*    Nashua, NH 03061                                                      */
  37. /*                                                                          */
  38. /*    FidoNet 1:132/101                      FidoNet 1:141/491              */
  39. /*    Data    (603) 888-8179                 Data    (203) 729-7569         */
  40. /*                                                                          */
  41. /*    Please feel free to contact us at any time to share your comments     */
  42. /*    about our software and/or licensing policies.                         */
  43. /*                                                                          */
  44. /*                                                                          */
  45. /*   This module is derived from code developed by Augie Hansen in his      */
  46. /*   book "Proficient C" published by Microsoft Press.  Mr. Hansen was      */
  47. /*   kind enough to give us verbal permission to use his routines, and      */
  48. /*   Bob, Vince and Alan (and all our full screen users) are grateful.      */
  49. /*   If you decide to use this code in some package you are doing, give     */
  50. /*   some thought to going out and buying the book. He deserves that.       */
  51. /*                                                                          */
  52. /*--------------------------------------------------------------------------*/
  53.  
  54. #include "sbuf.h"
  55. #include "com.h"
  56. #include "xfer.h"
  57. #include "zmodem.h"
  58. #include "keybd.h"
  59. #include "sched.h"
  60. #include "externs.h"
  61. #include "prototyp.h"
  62.  
  63. extern BUFFER Sbuf;
  64. extern CELLP Scrnbuf;
  65.  
  66. int sb_fill (win, ch, attr)
  67. REGIONP win;
  68. unsigned char ch;
  69. unsigned char attr;
  70. {
  71.    register int i, j;
  72.    unsigned int ca;
  73.  
  74.    ca = (attr << 8) | ch;
  75.  
  76.    for (i = win->sr0; i <= win->sr1; i++)
  77.       {
  78.       for (j = win->sc0; j <= win->sc1; j++)
  79.          {
  80.          (Scrnbuf + i * SB_COLS + j)->cap = ca;
  81.          }
  82.       if (win->sc0 < Sbuf.lcol[i])
  83.          {
  84.          Sbuf.lcol[i] = win->sc0;
  85.          }
  86.       if (win->sc1 > Sbuf.rcol[i])
  87.          {
  88.          Sbuf.rcol[i] = win->sc1;
  89.          }
  90.       }
  91.  
  92.    Sbuf.flags |= SB_DELTA;
  93.  
  94.    return (SB_OK);
  95. }
  96.  
  97. int sb_fillc (win, ch)
  98. REGIONP win;
  99. unsigned char ch;
  100. {
  101.    register int i, j;
  102.  
  103.    for (i = win->sr0; i <= win->sr1; i++)
  104.       {
  105.       for (j = win->sc0; j <= win->sc1; j++)
  106.          {
  107.          (Scrnbuf + i * SB_COLS + j)->b.ch = ch;
  108.          }
  109.       if (win->sc0 < Sbuf.lcol[i])
  110.          {
  111.          Sbuf.lcol[i] = win->sc0;
  112.          }
  113.       if (win->sc1 > Sbuf.rcol[i])
  114.          {
  115.          Sbuf.rcol[i] = win->sc1;
  116.          }
  117.       }
  118.  
  119.    Sbuf.flags |= SB_DELTA;
  120.  
  121.    return (SB_OK);
  122. }
  123.  
  124. int sb_filla (win, attr)
  125. REGIONP win;
  126. unsigned char attr;
  127. {
  128.    register int i, j;
  129.  
  130.    for (i = win->sr0; i <= win->sr1; i++)
  131.       {
  132.       for (j = win->sc0; j <= win->sc1; j++)
  133.          {
  134.          (Scrnbuf + i * SB_COLS + j)->b.attr = attr;
  135.          }
  136.       if (win->sc0 < Sbuf.lcol[i])
  137.          {
  138.          Sbuf.lcol[i] = win->sc0;
  139.          }
  140.       if (win->sc1 > Sbuf.rcol[i])
  141.          {
  142.          Sbuf.rcol[i] = win->sc1;
  143.          }
  144.       }
  145.  
  146.    Sbuf.flags |= SB_DELTA;
  147.  
  148.    return (SB_OK);
  149. }
  150.